import store from '@/store/index.js';
var NewModelCommand = function() {
	
};

NewModelCommand.prototype.setParentModel=function(parentModel){
	this.parentModel=parentModel;
};

NewModelCommand.prototype.setChildModel=function(childModel){
	this.childModel=childModel;
};

NewModelCommand.prototype.execute = function() {
	this.parentModel.children.push(this.childModel);
	var componentModel=store.state.formDesigner.componentModel;
	var newComponentModel=this.deepCopy(componentModel);
	store.state.formDesigner.componentModel=newComponentModel;
};

NewModelCommand.prototype.deepCopy=function(obj){
	let _obj = JSON.stringify(obj),
	objClone = JSON.parse(_obj);
	return objClone
};
export default NewModelCommand
